package org.example.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@LoadBalancerClient(name = "product-service",configuration = CustomLoadBalancerConfiguration.class)
@Configuration
public class BeanConfig {
    @Bean
    @LoadBalanced
    //spring-cloud的默认的是一个轮询的负载均衡，要想弄成一个随机的负载均衡器的时候
    //需要的进行写相关的配置，例如上面的
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
